<template>
    <div class="right-table">
        <el-table
            v-loading="!requestList"
            :data="requestList"
            stripe
            style="width: 100%"
        >
            <el-table-column
                v-for="(item, index) in tableOptions"
                :key="index"
                :prop="item.prop"
                :label="item.label"
            ></el-table-column>
        </el-table>
    </div>
</template>

<script>
import { auditTables } from '@/common/modul/table'

export default {
    props: {
        /** 当前表格类型 */
        audit: {
            type: Map,
            required: true
        },

        /** 请求来的数据 */
        requestList: {
            type: Array
        }
    },
    data() {
        return {
            tableOptions: auditTables[this.audit.get('auditType')] // 表格参数
        }
    },
    watch: {
        /** 切换显示表格类型 */
        audit(val) {
            this.tableOptions = auditTables[val.get('auditType')]
        }
    }
}
</script>

<style lang="less" scoped>
.right-table {
    margin: 0 30px;
}
</style>
